<!doctype html>
<html>
<head>
	<meta name="viewport" content="width=device-width,user-scalable=no,initial-scale=1.0" />
	<meta name="format-detection" content="telephone=no" />
	<meta charset="utf-8">
	<title>投我一票 立见福利！</title>
	<link rel="stylesheet" type="text/css" href="{:ADDON_PUBLIC_PATH}/public/css/style.css">
	<link rel="stylesheet" type="text/css" href="{:ADDON_PUBLIC_PATH}/home/css/home.css">
	<script type="text/javascript" src="{:ADDON_PUBLIC_PATH}/public/js/jquery-1.11.3.min.js"></script>
	<script type="text/javascript" src="{:ADDON_PUBLIC_PATH}/public/js/jquery.touchSwipe.min.js"></script>

	<script type="text/javascript">
		//静态变量
//		var IMG_PATH = "__IMG__";
//		var STATIC_PATH = "__STATIC__";
//		var WX_APPID = "{$jsapiParams.appId}";
//		var	WXJS_TIMESTAMP='{$jsapiParams.timestamp}';
//		var NONCESTR= '{$jsapiParams.nonceStr}';
//		var SIGNATURE= '{$jsapiParams.signature}';
	</script>
	<!--<script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>-->
	<!--<script type="text/javascript" src="minify.php?f=__JS__/prefixfree.min.js,__JS__/m/dialog.js,__JS__/m/flipsnap.min.js,__JS__/m/mobile_module.js"></script>-->


	<script type="text/javascript" src="{:ADDON_PUBLIC_PATH}/home/js/home.js"></script>


	<style type="text/css">
		/* 未得奖 */
		.wdjTcBg{
			background:rgba(0,0,0,0.6);
			position:fixed;
			top:0px;
			right:0px;
			bottom:0px;
			left:0px;
			z-index:999;
			display:none;
		}
		.wdjTcBg .wdjTcCen{
			width:290px;
			padding:5px 5px;
			background-color:#ffffff;
			position:absolute;
			left:50%;
			top:50%;
			margin:-162px 0px 0px -150px; /* 112 */
			opacity:0;
		}
		.wdjTcBg .wdjTcCen .wdjTcInfoBar{
			width:100%;
			height:auto;
			background-color:#eeeeee;
			overflow:hidden;
		}
		.wdjTcBg .wdjTcCen .wdjTcInfoBar .czBar{
			margin:0px 20px;
			padding:10px 0px;
			overflow:hidden;
		}
		.wdjTcBg .wdjTcCen .wdjTcInfoBar .czBar .closeBtn{
			display:block;
			font-style:normal;
			width:24px;
			height:24px;
			border-radius:50%;
			background-image:url(../../public/images/merListIcon.png);
			background-repeat:no-repeat;
			background-position:0px 0px;
			background-size:58px auto;
			cursor:pointer;
			float:right;
		}
		.wdjTcBg .wdjTcCen .wdjTcInfoBar .infoTitleBar{
			margin:0px 20px;
			text-align:center;
			overflow:hidden;
		}
		.wdjTcBg .wdjTcCen .wdjTcInfoBar .infoTitleBar .infoTitlePic{
			width:90px;
		}
		.wdjTcBg .wdjTcCen .wdjTcInfoBar .info{
			margin:10px 20px;
			text-align:center;
			overflow:hidden;
		}
		.wdjTcBg .wdjTcCen .wdjTcInfoBar .info p{
			text-align:center;
			font-size:14px;
			color:#393939;
		}
		.wdjTcBg .wdjTcCen .wdjTcInfoBar .info.wzjTitle p{
			font-size:16px;
			color:#000000;
		}
		.wdjTcBg .wdjTcCen .wdjTcInfoBar .info.gjjhts p{
			color:#ff4744;
		}
		.wdjTcBg .wdjTcCen .wdjTcInfoBar .info .jxgk{
			display:block;
			width:100px;
			height:40px;
			line-height:40px;
			text-align:center;
			color:#ffffff;
			font-size:16px;
			background-color:#ff4744;
			border-radius:5px;
			margin:15px auto 0;
		}

	</style>



</head>

<body>
<div class="wait">
	<div class="waitCen">
		<div class="waitBar">
			<div class="waitDh"></div>
		</div>
		<p>人家正在赶来了啦...</p>
	</div>
</div>
<div class="wrapCen">
	<div class="pageList">
		<div class="page page_0">
			<img src="{:ADDON_PUBLIC_PATH}/home/images/page_1.jpg" class="b" />
			<img src="{:ADDON_PUBLIC_PATH}/home/images/r_2.png" class="r_0" />
			<img src="{:ADDON_PUBLIC_PATH}/home/images/info_2.png" class="r_1" />
			<div class="yd"></div>
		</div>
		<div class="page page_1">
			<img src="{:ADDON_PUBLIC_PATH}/home/images/page_2.jpg" class="b" />
			<img src="{:ADDON_PUBLIC_PATH}/home/images/r_2.png" class="r_0" />
			<div class="yd"></div>
		</div>
		<div class="page page_2">
			<img src="{:ADDON_PUBLIC_PATH}/home/images/page_3.jpg" class="b" />
			<img src="{:ADDON_PUBLIC_PATH}/home/images/r_2.png" class="r_0" />
			<div class="hdgz">
				<p>活动时间：2015年11月5日-11月19日</p>
				<p>活动规则：</p>
				<p>1.为喜爱的商家投票即可参与抽奖。</p>
				<p>2.每天投票即可获得<font>三次</font>刮奖机会。</p>
				<p>3.中奖后请准确留下电话号码，否则中奖作废。</p>
			</div>
			<div class="yd"></div>
		</div>
		<div class="page page_3">
			<img src="{:ADDON_PUBLIC_PATH}/home/images/ml.jpg" class="b" />

			<!--xiugai代码-->
			<form id="form1" name="form1" method="post" action="{:U( 'join' )}" onSubmit="return checkForm();">

				<div class="merListCen">
					<ul class="merList">
						<volist name='opts' id='opt' key="k">
							<!-- 带图片投票 -->
							<if condition="$info['is_img'] && !empty($opt['image'])">
						<li class="merItem " >
							<img src="{$opt.image|get_cover_url}" class="merPic" />
							<div class="merInfoBar">
								<div class="merTitleBar">
									<h2 class="merTitle">{$opt.name|msubstr=0,15}</h2>
									<a href="{$opt.url}" class="merInfoMore">了解我></a>
								</div>
								<div class="merDePiaoBar">
									<span class="piaoNum">总票数：<font>{$opt.opt_count}</font>票</span>

									<notempty name="vote_options_arr">
										<php>if(in_array($opt[id], $vote_options_arr)){ </php>
										<a href="javascript:;" class="taoPiaoBtn taoPiaoBtnYt">已投</a>
										<php>	} else{ </php>
										<a href="javascript:;" class="taoPiaoBtn">投一票</a>
										<php> } </php>
										<else />
										<a href="javascript:;" class="taoPiaoBtn">投一票</a>
									</notempty>
								</div>
							</div>
							<p class="list" style="display:none">
								<input type="radio" class="{$style_cls}" id="check_{$opt.id}" name="optArr[]" value="{$opt.id}"
								<php> //if(in_array($opt[id], $joinData)) echo 'checked="checked" '; if(!$canJoin) echo ' disabled'; </php> >
								<label for="check_{$opt.id}"></label>
							</p>
						</li>
						</volist>

					</ul>
				</div>
				<input type="hidden" value="{:I('token')}" name="token" />
				<input type="hidden" value="{:I('wecha_id')}" name="wecha_id" />
				<input type="hidden" value="{$info.id}" name="vote_id" />
			</form>
		</div>

	</div>
	<!-- 二维码弹窗 -->
	<div class="tcBg">
		<div class="tc">
			<div class="tcHeader">
				<h1 class="tcHeaderTitle">通知</h1>
				<a href="javascript:;" class="closeBtn"></a>
			</div>
			<div class="tcCenBar">
				<div class="tcTishiInfoBar">
					<!--<span>投票成功！</span>-->
					<p>关注我们即可参与投票！</p>
				</div>
				<div class="erweimaBar">
					<img src="{:ADDON_PUBLIC_PATH}/home/images/erweima.png" class="erweimaPic" />
				</div>
				<div class="saomaBar">
					<div class="saomaCen">
						<i class="saomaTishiPic"></i>
						<div class="saomaWzTishi">
							<span>长按二维码！</span>
							<p>即可关注N37公众微信号</p>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
	<!-- 二维码弹窗 结束 -->
</div>



<!-- 未得奖弹窗 -->
<div class="wdjTcBg wdjTc">
	<div class="wdjTcCen">
		<div class="wdjTcInfoBar">
			<div class="info wzjTitle">
				<p>今天已经投过三次了</p>
			</div>
			<div class="info">
				<a href="javascript:;" class="jxgk">确定</a>
			</div>
		</div>
	</div>
</div>
<!-- 未得奖弹窗 结束 -->





<script type="text/javascript">
	//微信分享
//	$.WeiPHP.initWxShare({
//		title:"N37 我最喜爱的商家",
//		imgUrl:"http://magic-cn.com/weixin/N37/Uploads/Picture/sharepic.jpg",
//		desc:"投我一票 立见福利！为N37喜爱的商家投票即可参与抽奖哟~~",
//		link:window.location.href
//	})
</script>

<script>
	$(document).ready(function(){

		$(".merListCen .taoPiaoBtn").click(function () {
			var overtime="{$overtime}";
			if($(this).hasClass('disabled'))
			{
				if(overtime=='1'){
//					alert("该投票已过期");
					operWzj("该投票已过期");
				}else{
					operWzj("你已经投过票了2");
//					alert("你已经投过票了2");
				}
				return;
			}
			else
			{
				var this_obj = $(this);
				$(".choice_list li").addClass('disable');
				$(this).parents(".merItem").find(".list").find("input").prop("checked", true);
				var url = $('#form1').attr('action');
				var param = $('#form1').serializeArray();
//				alert(jQuery(".taoPiaoBtnYt").length);

				if(this_obj.hasClass("taoPiaoBtnYt"))
				{
					return false;
				}
				else
				{
					if( !this_obj.hasClass("taoPiaoBtnYt") && jQuery(".taoPiaoBtnYt").length < 3 )
					{



						//在三次内可以投递
						$.post(url,param,function(data)
						{
							if(data.status == 0)
							{
								//以及其他未知错误信息
//								operWzj(data.info);
								operErweima();
							}
							else
							{
								this_obj.addClass("taoPiaoBtnYt").text("已投");
								var font_obj = this_obj.parents(".merDePiaoBar").find('.piaoNum').find("font");
								font_obj.text((parseInt(font_obj.text())+1));
								//投票成功
								$('.tcBg').css('display','block');
								$(this).find('img').css('border-color','#c07b36');
								var totalCount = parseInt($('#totalCount').text());
								$('#totalCount').text(totalCount+1);
								operErweima();
							}
						})
					}
					else
					{
						operWzj("今天已经投过三次了");
					}
				}


			}
		});

		//	关闭弹窗
		$(".closeBtn").bind("click",function(){
			$('.tcBg').css('display','none');
		});



		/* 2015.11.04 */
		jQuery(".jxgk").bind("click",function(){
			closeWzj();
		});
		// 打开未中奖
		function operWzj(str){
			jQuery(".wdjTc").find(".info").find("p").text(str);
			jQuery(".wdjTc").fadeIn();
			jQuery(".wdjTc").find(".wdjTcCen").animate({
				"margin-top":"-112px",
				"opacity":"1"
			},"slow");
		}
		// 未中奖弹窗关闭
		function closeWzj(){
			jQuery(".wdjTcBg").fadeOut();
			jQuery(".wdjTcCen").animate({
				"margin-top":"-62px",
				"opacity":"0"
			},"slow",function(){
				jQuery(this).css("margin-top","-162px");
			});
		}

		// 打开二维码弹窗
		function operErweima(){
			jQuery(".tcBg").fadeIn();
			jQuery(".tc").animate({
				"margin-top":"-161px",
				"opacity":"1"
			},"slow");
		}

		// 关闭二维码弹窗
		function closeErweima(){
			jQuery(".tcBg").fadeOut();
			jQuery(".tc").animate({
				"margin-top":"-111px",
				"opacity":"0"
			},"slow",function(){
				jQuery(this).css("margin-top","-211px");
			});
		}


	});
</script>







</body>
</html>
